Optimal. Leaf size=309 \[ \frac {a^2 F_1\left (\frac {1}{2};\frac {1}{2} (-3-n),2;\frac {3}{2};\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right ) \cos (e+f x) (d \cos (e+f x))^n \cos ^2(e+f x)^{\frac {1}{2} (-1-n)} \sin (e+f x)}{\left (a^2-b^2\right )^2 f}+\frac {b^2 F_1\left (\frac {1}{2};\frac {1}{2} (-1-n),2;\frac {3}{2};\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right ) \cos (e+f x) (d \cos (e+f x))^n \cos ^2(e+f x)^{\frac {1}{2} (-1-n)} \sin (e+f x)}{\left (a^2-b^2\right )^2 f}-\frac {2 a b F_1\left (\frac {1}{2};\frac {1}{2} (-2-n),2;\frac {3}{2};\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right ) (d \cos (e+f x))^n \cos ^2(e+f x)^{-n/2} \sin (e+f x)}{\left (a^2-b^2\right )^2 f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.36, antiderivative size = 309, normalized size of antiderivative = 1.00, number of steps
used = 10, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {4349, 3954,
2903, 3268, 440} \begin {gather*} \frac {a^2 \sin (e+f x) \cos (e+f x) \cos ^2(e+f x)^{\frac {1}{2} (-n-1)} (d \cos (e+f x))^n F_1\left (\frac {1}{2};\frac {1}{2} (-n-3),2;\frac {3}{2};\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right )}{f \left (a^2-b^2\right )^2}+\frac {b^2 \sin (e+f x) \cos (e+f x) \cos ^2(e+f x)^{\frac {1}{2} (-n-1)} (d \cos (e+f x))^n F_1\left (\frac {1}{2};\frac {1}{2} (-n-1),2;\frac {3}{2};\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right )}{f \left (a^2-b^2\right )^2}-\frac {2 a b \sin (e+f x) \cos ^2(e+f x)^{-n/2} (d \cos (e+f x))^n F_1\left (\frac {1}{2};\frac {1}{2} (-n-2),2;\frac {3}{2};\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right )}{f \left (a^2-b^2\right )^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 440
Rule 2903
Rule 3268
Rule 3954
Rule 4349
Rubi steps
\begin {align*} \int \frac {(d \cos (e+f x))^n}{(a+b \sec (e+f x))^2} \, dx &=\left ((d \cos (e+f x))^n (d \sec (e+f x))^n\right ) \int \frac {(d \sec (e+f x))^{-n}}{(a+b \sec (e+f x))^2} \, dx\\ &=\left (\cos ^{-n}(e+f x) (d \cos (e+f x))^n\right ) \int \frac {\cos ^{2+n}(e+f x)}{(b+a \cos (e+f x))^2} \, dx\\ &=\left (\cos ^{-n}(e+f x) (d \cos (e+f x))^n\right ) \int \left (\frac {b^2 \cos ^{2+n}(e+f x)}{\left (b^2-a^2 \cos ^2(e+f x)\right )^2}-\frac {2 a b \cos ^{3+n}(e+f x)}{\left (b^2-a^2 \cos ^2(e+f x)\right )^2}+\frac {a^2 \cos ^{4+n}(e+f x)}{\left (-b^2+a^2 \cos ^2(e+f x)\right )^2}\right ) \, dx\\ &=\left (a^2 \cos ^{-n}(e+f x) (d \cos (e+f x))^n\right ) \int \frac {\cos ^{4+n}(e+f x)}{\left (-b^2+a^2 \cos ^2(e+f x)\right )^2} \, dx-\left (2 a b \cos ^{-n}(e+f x) (d \cos (e+f x))^n\right ) \int \frac {\cos ^{3+n}(e+f x)}{\left (b^2-a^2 \cos ^2(e+f x)\right )^2} \, dx+\left (b^2 \cos ^{-n}(e+f x) (d \cos (e+f x))^n\right ) \int \frac {\cos ^{2+n}(e+f x)}{\left (b^2-a^2 \cos ^2(e+f x)\right )^2} \, dx\\ &=\frac {\left (a^2 \cos ^{2 \left (\frac {1}{2}+\frac {n}{2}\right )-n}(e+f x) (d \cos (e+f x))^n \cos ^2(e+f x)^{-\frac {1}{2}-\frac {n}{2}}\right ) \text {Subst}\left (\int \frac {\left (1-x^2\right )^{\frac {3+n}{2}}}{\left (a^2-b^2-a^2 x^2\right )^2} \, dx,x,\sin (e+f x)\right )}{f}+\frac {\left (b^2 \cos ^{2 \left (\frac {1}{2}+\frac {n}{2}\right )-n}(e+f x) (d \cos (e+f x))^n \cos ^2(e+f x)^{-\frac {1}{2}-\frac {n}{2}}\right ) \text {Subst}\left (\int \frac {\left (1-x^2\right )^{\frac {1+n}{2}}}{\left (-a^2+b^2+a^2 x^2\right )^2} \, dx,x,\sin (e+f x)\right )}{f}-\frac {\left (2 a b (d \cos (e+f x))^n \cos ^2(e+f x)^{-n/2}\right ) \text {Subst}\left (\int \frac {\left (1-x^2\right )^{\frac {2+n}{2}}}{\left (-a^2+b^2+a^2 x^2\right )^2} \, dx,x,\sin (e+f x)\right )}{f}\\ &=\frac {a^2 F_1\left (\frac {1}{2};\frac {1}{2} (-3-n),2;\frac {3}{2};\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right ) \cos (e+f x) (d \cos (e+f x))^n \cos ^2(e+f x)^{\frac {1}{2} (-1-n)} \sin (e+f x)}{\left (a^2-b^2\right )^2 f}+\frac {b^2 F_1\left (\frac {1}{2};\frac {1}{2} (-1-n),2;\frac {3}{2};\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right ) \cos (e+f x) (d \cos (e+f x))^n \cos ^2(e+f x)^{\frac {1}{2} (-1-n)} \sin (e+f x)}{\left (a^2-b^2\right )^2 f}-\frac {2 a b F_1\left (\frac {1}{2};\frac {1}{2} (-2-n),2;\frac {3}{2};\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right ) (d \cos (e+f x))^n \cos ^2(e+f x)^{-n/2} \sin (e+f x)}{\left (a^2-b^2\right )^2 f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(13974\) vs. \(2(309)=618\).
time = 42.16, size = 13974, normalized size = 45.22 \begin {gather*} \text {Result too large to show} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.10, size = 0, normalized size = 0.00 \[\int \frac {\left (d \cos \left (f x +e \right )\right )^{n}}{\left (a +b \sec \left (f x +e \right )\right )^{2}}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (d \cos {\left (e + f x \right )}\right )^{n}}{\left (a + b \sec {\left (e + f x \right )}\right )^{2}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \int \frac {{\left (d\,\cos \left (e+f\,x\right )\right )}^n}{{\left (a+\frac {b}{\cos \left (e+f\,x\right )}\right )}^2} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________